<?php
/**
 * XmuSlh, web platform of Student Association Federation of Xiamen University
 * 
 * Rewritting one or some pages of StatusNet. 
 * To get the original version, please visit <http://status.net/>.
 * 
 * StatusNet, the distributed open-source microblogging tool
 * 
 * LICENCE: This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

/**
 * Addprofileuser action form.
 * 添加社联会用户的表格.
 * 
 * @author		ytukie <ytukie@gmail.com>
 * @version		0.1
 */

// XmuSlh only.
if ( !defined('XMUSLH')) { exit(1); }

// Requirements.
require_once INSTALLDIR . '/lib/slh_form.php';
require_once INSTALLDIR . '/lib/slh_rights.php';


class AddprofileuserForm extends Form
{
	/**
	 * ID of the from
	 */
	function id()
	{
		return 'id_form_addprofileuser';
	}
	
	/**
	 * Class of the form.
	 */
	/*
	function formClass()
	{
		// return 'class_settingsform';
	}
	*/
	
	/**
	 * Action of the form
	 * 
	 * Return the string URL of the action.
	 */
	function action()
	{
		return slh_action2url('addprofileuser');
	}
	
	/**
	 * Name of the form
	 */
	function formLegend()
	{
		$this->out->element('legend', null, 'add profile');
	}
	
	/**
	 * Data elements.
	 */
	function formData()
	{
		$this->out->elementStart('dl', array('class' => 'cls_dl_form'));
		
		$this->out->element('dt', null, '账户信息');
		$this->out->elementStart('dd');
		$this->out->elementStart('ul');
			$this->out->elementStart('li');
			$this->out->input('username',
							  '用户名',
							  $this->getField('username'),
							  '登录时输入的用户名');
			$this->out->elementEnd('li');
			
			$this->out->elementStart('li');
			$this->out->readonly('password',
							  	 '密码',
							  	 '与用户名相同');
			$this->out->elementEnd('li');
		$this->out->elementEnd('ul');
		$this->out->elementEnd('dd');
		
		$this->out->element('dt', null, '个人信息');
		$this->out->elementStart('dd');
		$this->out->elementStart('ul');
			$this->out->elementStart('li');
			$this->out->input('realname',
							  '真实姓名',
							  $this->getField('realname'),
							  '要是真的呃.');
			$this->out->elementEnd('li');
			
			$this->out->elementStart('li');
			$this->out->input('pinyin',
							  '姓名拼音', 
							  $this->getField('pinyin'),
							  '[选填]用于简化查找呃.');
			$this->out->elementEnd('li');
			
			$this->out->elementStart('li');
			$this->out->input('department',
							  '所属部门', 
							  $this->getField('department'),
							  '所属社联会的部门');
			$this->out->elementEnd('li');
		$this->out->elementEnd('ul');
		$this->out->elementEnd('dd');
		
// TODO: Finish the RIGHT settings.
		$this->out->element('dt', null, '权限设置');
		$this->out->elementStart('dd');
		$this->out->elementStart('div', 'cls_div_rights');
		$this->out->elementStart('ul');
			$this->out->elementStart('li');
			$this->out->checkbox('right_news', '新鲜事');
			$this->out->elementEnd('li');
			
			$this->out->elementStart('li');
			$this->out->checkbox('right_photoset', '相册');
			$this->out->elementEnd('li');
			
			$this->out->elementStart('li');
			$this->out->checkbox('right_data', '资料下载');
			$this->out->elementEnd('li');
			
			$this->out->elementStart('li');
			$this->out->checkbox('right_association', '社团用户');
			$this->out->elementEnd('li');
			
			if (Rights::rootProtection()) {
				$this->out->elementStart('li');
				$this->out->checkbox('right_profile', '社联会用户');
				$this->out->elementEnd('li');
			}
		$this->out->elementEnd('ul');
		$this->out->elementEnd('div');
		$this->out->elementEnd('dd');
		
		$this->out->elementEnd('dl');
	}
	
	/**
	 * Action elements.
	 */
	function formActions()
	{
		$this->out->elementStart('div', 'formaction');
		$this->out->submit('submit',
						   '添加',
						   'submit',
						   'add',
						   '添加一个社联会用户.');
		$this->out->elementEnd('div');
	}
}